// JavaScript Document
/*
	许愿墙纸条插件
	凌天蓝 2010.3.17

*/
(function($) {

    $.extend($.fn, {
        jWishForList: function(config) {
			var defaults = {
				id:0,
				title:'',
				content:'',
				sender:'',
				date:'',
				itemClassName:'jquery-wish-list-item',
				titleClassName:'jquery-wish-list-title',
				contentClassName:'jquery-wish-list-content',
				bottomClassName:'jquery-wish-list-bottom',
				hoverClassName:''
			};
			
            var opts = $.extend(defaults, config);
			
            /* ---------->
            html tree:
            <div>                  ---->wish item
				<div></div>          |---->title
				<div></div>		     |---->content		
				<div></div>          |---->sender date
            </div>
            <-----------*/
			var $wish = $('<div><div></div><div></div><div></div></div>')
								 .addClass(opts.itemClassName)
								 .appendTo($(this));
			
			
			// 纸条标题
            $wish.find('div:eq(0)').text('纸条编号:' + opts.id + ' ' + opts.title)
				 .addClass(opts.titleClassName);
			// 纸条内容
			$wish.find('div:eq(1)').text(opts.content)
				 .addClass(opts.contentClassName);

			$wish.find('div:eq(2)').text('——' + opts.sender + '(' + opts.date.format('yyyy-MM-dd hh:mm:ss') +')')
			      .addClass(opts.bottomClassName);

            return $(this);
        }

    });


})(jQuery);